package org.interesting.joone;

import org.joone.engine.Pattern;
import org.joone.io.StreamOutputSynapse;

/**
 * 控制台输出
 * 
 * @author wwxiang
 * @since 2018/6/25.
 */
public class ConsoleOutputSynapse extends StreamOutputSynapse {

	@Override
	public void write(Pattern pattern) {
		if (pattern.getCount() == -1) {
			return;
		}

		double[] array = pattern.getArray();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < array.length; i++) {
			sb.append(array[i]);
			if (i < (array.length - 1)) {
				sb.append(",");
			}
		}
		System.out.println(">> " + sb);
	}
}
